<template>
  <div class="ehb all">
    <ehb-header service-name="我的申请" :area="jdxx.jdmc" v-if="isShow"></ehb-header>
    <ehb-content-row :row-data-list="applicationList" click="defClick" @defClick="click"></ehb-content-row>
    <ehb-footer v-if="isShow"></ehb-footer>
  </div>
</template>

<script>
  export default {
    name: "MyApplication",
    data() {
      return {
        applicationList: [],
        userInfo: {},
        jdxx: {},
        isShow:false
      }
    },
    mounted() {
      let that = this;
      ehbAppJssdk.user.getUserInfo({
        success: function (res) {
          that.userInfo = res;
            ehbAppJssdk.operateWindow.getPrePageParams({
                success: function (res) {
                    that.jdxx = JSON.parse(res);
                    ehbAppJssdk.notice.showPreloader({text: "正在查询中..."});
                    ehbAppJssdk.network.request({
                        url: that.GLOBAL.urlConfig.getMyApplication[that.GLOBAL.urlType],
                        method: 'post',
                        data: {'zjh': that.userInfo.idCards, 'jdid': that.jdxx.id},
                        headers: {'contentType': 'application/x-www-form-urlencoded'},
                        success: function (res) {
                            if (res && res.status == 0) {
                                if (res.result && res.result.length > 0) {
                                    ehbAppJssdk.notice.hidePreloader();
                                    that.isShow=true;
                                    for (let i in res.result) {
                                        let ywlxdm =[];
                                        let data = res.result[i];
                                        let name = [];
                                        name.push(data.sqbh);
                                        name.push(data.ywlxmc);
                                        ywlxdm.push(data.ywlxdm);
                                        switch (data.qqzt) {
                                            case -1:
                                                ;
                                            case 1:
                                                name.push("待申请");
                                                break;
                                            case 0:
                                                name.push("已申请");
                                                break;
                                        }
                                        name.push(data.sqsj);
                                        that.applicationList.push({
                                            "name": name,
                                            "qqzt": data.qqzt,
                                            "sqbh": data.sqbh,
                                            "currentStep": data.currentStep,
                                            "sqbsid": data.sqbsid,
                                            "ywlxdm": ywlxdm,
                                            "ywlxmc": data.ywlxmc
                                        });
                                    }
                                } else {
                                    that.toNOData("未查询到申请的数据!",1);
                                }
                            }else{
                                that.toNOData("未查询到申请的数据!",1);
                            }
                        },
                        fail: function (res) {
                            that.toNOData("未查询到申请的数据!",1);
                        }
                    });
                }
            });
        }
      });
    },
    methods: {
      click(param) {
        let that = this;
        let url = "";
        switch (param.qqzt) {
          case -1:
            ;
          case 1:
            if(param.ywlxdm == '005'){
              url = absoultPath + "/onlineProcessing/Qkysfzydj";
            }else if(param.ywlxdm == '010'){
              url = absoultPath + "/onlineProcessing/Esfzydj";
            }else if(param.ywlxdm == '006'){
                url = absoultPath + "/onlineProcessing/Ybdydj";
            }else if(param.ywlxdm == '007'){
                url = absoultPath + "/onlineProcessing/Dyzxdj";
            }else if(param.ywlxdm == '011'){
                url = absoultPath + "/onlineProcessing/Bgdj";
            }else if(param.ywlxdm == '012'){
                url = absoultPath + "/onlineProcessing/Ygdj";
            }else if(param.ywlxdm == '0061'){
                url = absoultPath + "/onlineProcessing/FdZgedydj";
            }else if(param.ywlxdm == '008'){
                url = absoultPath + "/onlineProcessing/Gyjsydsyqjfwsyqzxdj";
            }else if(param.ywlxdm == '002'){
                url = absoultPath + "/onlineProcessing/Ygspfdyygdj";
            }else if(param.ywlxdm == '004'){
                url = absoultPath + "/onlineProcessing/Ygspfdyygzxdj";
            }
            break;
          case 0:
            url = absoultPath + "/onlineProcessing/ApplicationResult";
            break;
        }

        let params = this.copyDeep(param);
        Object.assign(params, that.jdxx);
        ehbAppJssdk.operateWindow.open({
          title: '',
          url: url,
          urlType: 'webPage',
          backRefresh: '0',
          reloadForLogin: '1',
          closeCurrentPage: '0',
          disableScrolling: 'disable',
          pageType: '1',
          pageLevel: '2',
          params: params
        });
      },
      /**
       * 查询办理进度
       */
      getProgress() {

      }
    }
  }
</script>

<style scoped>

</style>
